package com.loongtech.bi.manager.client;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.loongtech.bi.entity.client.EntityEventAnalysis;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;

@Service
public class EventAnalysisManager extends ManagerQueryCacheBase<EntityEventAnalysis> {
	private static final long serialVersionUID = 1L;
	
	/**
	 * 获取 EntityEventAnalysis 细节
	 * @param dateStart
	 * @param dateEnd
	 * @param queryPlatform
	 * @param queryChannel
	 * @param queryServer
	 * @param addtype
	 * @return
	 */
	public List<Object[]> getDetailEventAnalysisByStepcode(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel,String stepcode) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),stepcode,finishnum,uuidnum,useridnum,roleidnum from EntityEventAnalysis  where 1=1 and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' and stepcode = "+stepcode+" order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}
	
	/**
	 * 获取 EntityEventAnalysis 细节
	 * @param dateStart
	 * @param dateEnd
	 * @param queryPlatform
	 * @param queryChannel
	 * @param queryServer
	 * @param addtype
	 * @return
	 */
	public List<Object[]> getDetailEventAnalysis(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),stepcode,finishnum,uuidnum,useridnum,roleidnum from EntityEventAnalysis  where 1=1 and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}
	
	/**
	 * 获取 EntityEventAnalysis 细节
	 * @param dateStart
	 * @param dateEnd
	 * @param queryPlatform
	 * @param queryChannel
	 * @param queryServer
	 * @param addtype
	 * @return
	 */
	public List<Object[]> getDetailEventAnalysisInStepcode(Date dateStart, Date dateEnd, String queryPlatform, String queryChannel,String stepcode) {
		return findByQuery("select date_format(day,'%Y-%m-%d'),stepcode,finishnum,uuidnum,useridnum,roleidnum from EntityEventAnalysis  where 1=1 and day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' and stepcode in "+stepcode+" order by day desc", "dayStart", dateStart, "dayEnd", dateEnd);
	}
}
